Skip to content

feat: live slot migration for cluster resharding - #34

Merged
kacy merged 3 commits into
mainfrom
feat/cluster-migration
Feb 6, 2026
Merged

feat: live slot migration for cluster resharding#34
kacy merged 3 commits into
mainfrom
feat/cluster-migration

Conversation

@kacy

@kacy kacy commented Feb 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • adds migration.rs module with core migration types and state management
  • implements Migration struct tracking source/target nodes and state transitions
  • implements MigrationManager for tracking active incoming/outgoing migrations
  • implements MigrationBatch for streaming keys between nodes during migration
  • adds protocol support for CLUSTER SETSLOT commands (IMPORTING, MIGRATING, NODE, STABLE)
  • adds MIGRATE command for moving individual keys
  • adds remaining CLUSTER commands: MEET, ADDSLOTS, DELSLOTS, FORGET, REPLICATE, FAILOVER, COUNTKEYSINSLOT, GETKEYSINSLOT

Tested

  • cargo test -p ember-cluster - 56 tests pass
  • cargo test -p ember-protocol - 223 tests pass
  • cargo test - all tests pass
  • cargo clippy - no warnings

Design considerations

  • migration state machine tracks: Importing → Migrating → Streaming → Finalizing → Complete
  • key tracking allows ASK redirects for already-migrated keys
  • MigrationConfig provides tunables for batch sizes, timeouts, and delays
  • all new commands return cluster-disabled error in non-cluster mode

kacy added 3 commits February 6, 2026 08:22
implements the core migration types and state management:
- Migration struct with source/target nodes and state tracking
- MigrationManager for tracking active incoming/outgoing migrations
- MigrationBatch for streaming keys between nodes
- MigrationRedirect for MOVED/ASK responses
- MigrationConfig for tuning batch sizes and timeouts
adds protocol support for slot migration commands:
- CLUSTER SETSLOT <slot> IMPORTING <node-id>
- CLUSTER SETSLOT <slot> MIGRATING <node-id>
- CLUSTER SETSLOT <slot> NODE <node-id>
- CLUSTER SETSLOT <slot> STABLE
- MIGRATE host port key db timeout [COPY] [REPLACE]

handlers return cluster-disabled error in non-cluster mode
adds protocol support for cluster management:
- CLUSTER MEET <ip> <port>
- CLUSTER ADDSLOTS <slot> [slot...]
- CLUSTER DELSLOTS <slot> [slot...]
- CLUSTER FORGET <node-id>
- CLUSTER REPLICATE <node-id>
- CLUSTER FAILOVER [FORCE|TAKEOVER]
- CLUSTER COUNTKEYSINSLOT <slot>
- CLUSTER GETKEYSINSLOT <slot> <count>

all handlers return cluster-disabled error in non-cluster mode
@kacy
kacy merged commit cf8e6fd into main Feb 6, 2026
5 checks passed
@kacy
kacy deleted the feat/cluster-migration branch February 7, 2026 20:06
kacy added a commit that referenced this pull request Feb 11, 2026
feat: live slot migration for cluster resharding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant